﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:AutoForm="clr-namespace:DevKnightlie.WPF.AutoForm;assembly=DevKnightlie.WPF.AutoForm" 
        x:Class="DevKnightlie.WPF.AutoForm.Demo.MainWindow"
        Title="AutoForm Demo" Height="500" Width="650">
    <TabControl Margin="0">
        <TabItem Header="Simple">
            <Grid Background="#FFE5E5E5" DataContext="{StaticResource SimpleDataModel}">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This form shows the simplest 
                        use of AutoForm - an AutoFormPanel control linked to a 
                        ModelObjectFormDefiner whose ModelObject property is the
                        DataContext. All writeable properties are given an input field.</TextBlock>
                <AutoForm:AutoFormPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    ModelObjectFormDefiner="{StaticResource SimpleModelDefiner}"
                    x:Name="SimpleForm"/>
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="Simple+Codebehind" DataContext="{StaticResource FileProcessDataModel}">
            <Grid Background="#FFE5E5E5">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This page is the same setup as the Simple page,
                        but a little bit of codebehind overrides the types of input fields
                        created for certain properties. Note how the FileType property gets a combo-box automatically.</TextBlock>
                    <AutoForm:AutoFormPanel 
                        ModelObjectFormDefiner="{StaticResource FileProcessModelDefiner}"
                        x:Name="FileProcessCodebehindForm"/>
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="XAML Definition">
            <Grid Background="#FFE5E5E5" DataContext="{StaticResource ReportSettingsDataModel}">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This page has a list of field definitions explictly 
                    defined in App.xaml. Create a static instance of a FieldDefinitionList containing a BaseFieldDefinition-descended object 
                    for each field. Your AutoFormPanel instance then uses this for it's FieldDefinitionList property. Adjust the 
                    Progress Bar value using the Report Progress slider for added fun.</TextBlock>
                    <AutoForm:AutoFormPanel 
                        x:Name="XAMLForm" 
                        FieldDefinitions="{StaticResource StaticFieldDefinitions}" />
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="Advanced Input Controls">
            <Grid Background="#FFE5E5E5" DataContext="{StaticResource AdvancedDataModel}">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This page contains some more advanced features: the phone number field 
                    requires 10 or 11 digits and uses a RegEx pattern to validate this; the ability to add skills to the listbox 
                    is done through bindings - the only code required sets up the list box field definition, and there's an ICommad object to add 
                        the new skill to the list.</TextBlock>
                    <AutoForm:AutoFormPanel 
                        x:Name="AdvancedForm" 
                        ModelObjectFormDefiner="{StaticResource AdvancedModelDefiner}" />
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="Stacked Layout">
            <Grid Background="#FFE5E5E5" DataContext="{StaticResource SimpleDataModel2}">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This form uses a 
                        Stacked layout strategy to arrange input controls and labels.</TextBlock>
                    <AutoForm:AutoFormPanel 
                        x:Name="StackedForm"
                        ModelObjectFormDefiner="{StaticResource SimpleModelDefiner2}"                                            
                        LayoutStrategy="{StaticResource StackedLayoutStrategy}"/>
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="Sub-Forms">
            <Grid Background="#FFE5E5E5">
                <StackPanel Margin="0">
                    <TextBlock Height="65" TextWrapping="Wrap">This form uses the new SubFormFieldDefinition to include 
                    two sub-forms containing account holder details. Each sub-form has it's own field definiton list or model
                    object form definer.  You can also choose the kind of container the form should be in: 
                    either a GroupBox or Expander control.</TextBlock>
                    <AutoForm:AutoFormPanel x:Name="SubFormForm"
                                        FieldDefinitions="{StaticResource SubFormOuterFields}"/>
                </StackPanel>
            </Grid>
        </TabItem>
    </TabControl>

</Window>
